//类方法

public class demo3_2{
    //变量
 private int sum1;
 private String sum2;
 //构造方法初始定义sum1，sum2
 public  demo3_2(){};
 public  demo3_2(int sum1){
     this.sum1=sum1;
    }
 public  demo3_2(String sum2){
     this.sum2=sum2;
    }
 public  demo3_2(int sum1,String sum2){
    this.sum1=sum1;
    this.sum2=sum2;
    }
    //set,get方法
    public void setSum1(int a)
    {
        if(a>0){
            System.out.println("sum1必须小于0");
        }else{sum1=a;
        System.out.println("sum1的值设置完成");
        }
    }
    
    public void setSum2(String a)
    {
       sum2=a;
        System.out.println("sum2的值设置完成");
        
    }
    
    public int getSum1()
    {
    return sum1;
    }
    
    public String getSum2()
    {
    return sum2;
    }      
}    


 
    
